home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Examples / DemoText / UScriptMenu.h < prev    next >
Encoding:
Text File  |  1996-04-03  |  1.8 KB  |  72 lines  |  [TEXT/MPS ]

  1. // UScriptMenu.h
  2. // Copyright © 1989-96 by Apple Computer, Inc. All rights reserved.
  3.  
  4. // This behavior adds support for a "Scripts" folder and menu.
  5. // The "Scripts" folder may contain global, startup, and shared
  6. // handler scripts which are inserted into the OSA event handling
  7. // system. Additional scripts are added to a "Scripts" menu.
  8.  
  9. #ifndef __USCRIPTMENU__
  10. #define __USCRIPTMENU__
  11.  
  12. // MacApp
  13.  
  14. #ifndef __PASCALSTRING__
  15. #include "PascalString.h"
  16. #endif
  17.  
  18. #ifndef __UBEHAVIOR__
  19. #include "UBehavior.h"
  20. #endif
  21.  
  22. // Toolbox
  23.  
  24. #ifndef __COMPONENTS__
  25. #include <Components.h>
  26. #endif
  27.  
  28. #ifndef __FILES__
  29. #include <Files.h>
  30. #endif
  31.  
  32.  
  33. const short mScripts = 66;                        // Kind of a weird number which hopefully won't conflict with any of your existing menu ids
  34.  
  35. const short kScriptMenuStrings = 66;
  36. const short kFolderName = 1;
  37. const short kGlobalsScript = 2;
  38. const short kSharedScript = 3;
  39. const short kStartupScript = 4;
  40.  
  41. class TScriptMenuBehavior : public TBehavior
  42. {
  43.     MA_DECLARE_CLASS;
  44.  
  45.   public:
  46.     FSSpec fScriptFolder;
  47.  
  48.     TScriptMenuBehavior();
  49.     virtual ~TScriptMenuBehavior();
  50.  
  51.     virtual void IScriptMenuBehavior();
  52.         // Initialize the TScriptMenuBehavior
  53.  
  54.     void InstallGlobalsScript(ComponentInstance theCmp,
  55.                               const CStr63& scriptFolderName,
  56.                               const CStr63& globalsScriptName,
  57.                               long& stdScriptsFound);
  58.     void InstallSharedScript(ComponentInstance theCmp,
  59.                              const CStr63& sharedScriptName,
  60.                              long& stdScriptsFound);
  61.     void ExecuteStartupScript(ComponentInstance theCmp,
  62.                               const CStr63& startupScriptName,
  63.                               long& stdScriptsFound);
  64.     void AddScriptMenu(const CStr63& globalsScriptName,
  65.                        const CStr63& sharedScriptName,
  66.                        const CStr63& startupScriptName,
  67.                        long& stdScriptsFound);
  68.  
  69.     virtual void DoMenuCommand(CommandNumber aCommandNumber);
  70. };
  71.  
  72. #endif // __USCRIPTMENU__